Skip to content

snp: validate certificate table bounds - #413

Draft
brongan wants to merge 2 commits into
virtee:mainfrom
brongan:fix-cert-table-bounds
Draft

brongan wants to merge 2 commits into
virtee:mainfrom
brongan:fix-cert-table-bounds

Conversation

@brongan

@brongan brongan commented Nov 11, 2026 •

Copy link
Copy Markdown

Parse certificate tables from byte buffers instead of raw pointers. Check each entry offset and length against the buffer size. Return an error when an entry exceeds the buffer or when the table lacks a terminating entry.

The certificate table parser trusted offsets and lengths from the input table. Malformed input caused out-of-bounds reads and panics in a safe public function.

@brongan
brongan force-pushed the fix-cert-table-bounds branch from f6b37f0 to c0b16c5 Compare November 11, 2026 19:12
@brongan
brongan force-pushed the fix-cert-table-bounds branch 2 times, most recently from ae6d4c4 to 8a792f1 Compare November 12, 2026 19:30
@brongan brongan changed the title snp: bounds-check certificate table parsing snp: validate certificate table bounds Nov 12, 2026
@brongan
brongan force-pushed the fix-cert-table-bounds branch from 8a792f1 to 5ec17e4 Compare November 12, 2026 19:37
Check the firmware error status after each report request. Allocate a
larger buffer and retry when the firmware needs more space. Confirm that
a certificate buffer exists before reading its entries. Parse the
certificate table from the allocated buffer.

Some kernels do not fail the ioctl when the certificate buffer is too
small. On those kernels, the code read the certificate table from an
invalid placeholder address.

Signed-off-by: Brennan Tracy <[email protected]>
Parse certificate tables from byte buffers instead of raw pointers.
Check each entry offset and length against the buffer size. Return an
error when an entry exceeds the buffer or when the table lacks a
terminating entry.

The certificate table parser trusted offsets and lengths from the input
table. Malformed input caused out-of-bounds reads and panics in a safe
public function.

Signed-off-by: Brennan Tracy <[email protected]>
@brongan
brongan force-pushed the fix-cert-table-bounds branch from 5ec17e4 to 5876667 Compare November 13, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant